<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./layui/layui.js"></script>
    <link rel="stylesheet" href="./layui/css/layui.css">
</head>

<body>
    <button>
        登录
    </button>

    <script>

        layui.use(function () {
            let $ = layui.$;

        })

        let btn = document.querySelector('button');
        btn.onclick = function () {
            parent//父页面对象

            // var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
            // console.log(index);
            // // parent.layer.close(index)
            // parent.layer.closeAll()


            // // //父页面对象-- 发送消息给父页面
            // parent.postMessage('msg1', '*')
            console.log('点击了 btn');

            window.parent.postMessage('111', '*');


        }



    </script>

</body>

</html>